home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_jeep_bab.cog < prev    next >
Text File  |  1999-11-15  |  4KB  |  164 lines

  1. # Jones 3D Cog Script
  2. #
  3. # Jeep_bab.cog
  4. #
  5. # [PKM]
  6. #
  7. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13.     message        startup
  14.     message        created
  15.     message        activated
  16.     message        callback
  17.  
  18.     sound        someGas=INXJ243.wav                    local
  19.     sound        gasCanOn=jep_gascan_attach.wav        local
  20.     sound        gasCanOff=jep_gascan_detach.wav        local
  21.  
  22.     thing        jeep                                local
  23.     thing        indy                                local
  24.  
  25.     int            jeepMesh                            local
  26.     int            meshRef                                local
  27.     int            gasCanBin=66                        local
  28.     int            isTakingCan=0                        local
  29.     int            bStartCutscene=0                    local
  30.  
  31.     flex        dotProduct                            local
  32.     flex        rightDot                            local
  33.  
  34.     vector        indyVector                            local
  35.     vector        cameraPos                            local
  36.  
  37.     model        jeepGasCan=gascan_bab_jeep.3do        local
  38.  
  39.     keyframe    in_reach=in_pickup_med.key            local
  40.  
  41. end
  42.  
  43. # ========================================================================================
  44.  
  45. code
  46.  
  47. startup:
  48.  
  49.     indy = GetLocalPlayerThing();
  50.     return;
  51.  
  52. created:
  53.     jeep = GetSenderRef();
  54.     jeepMesh = GetMeshByName(jeep, "jeep_body");
  55.     meshRef = SetThingMesh(jeep, jeepMesh, jeepGasCan, 0);
  56.  
  57.     SetThingUserData(jeep, meshRef);
  58.     return;
  59.  
  60. activated:
  61.     indyVector = VectorNorm(VectorSub(GetThingPos(jeep), GetThingPos(indy)));
  62.  
  63.     # Check to see where Indy is standing relative to the jeep
  64.     dotProduct = VectorDot(GetThingLVec(jeep), indyVector);
  65.     rightDot = VectorDot(GetThingRVec(jeep), indyVector);
  66.  
  67.  
  68.     # Check to see if Indy is positioned near the gas can.
  69.     if ((dotProduct >= 0.904) && (dotProduct <= 0.997) && (rightDot > 0))
  70.     {
  71.         meshRef = GetThingUserData(jeep);
  72.  
  73.         # The player has activated the jeep near the gas can bracket.
  74.         if (meshRef == -1)
  75.         {
  76.             if (GetCurItem(indy) == gasCanBin)
  77.             {
  78.                 isTakingCan = 0;
  79.                 bStartCutscene = 1;
  80.  
  81.                 SendMessage(GetCogByIndex(0), user1);
  82.             }
  83.         }
  84.         else
  85.         {
  86.             isTakingCan = 1;
  87.             bStartCutscene = 1;
  88.  
  89.             SendMessage(GetCogByIndex(0), user0);
  90.         }
  91.     }
  92.  
  93.     if (bStartCutscene)
  94.     {
  95.         if (MakeMeStop() == -1)
  96.         {
  97.             bStartCutscene = 0;
  98.             return;
  99.         }
  100.         # RT: Fixed bug #7626
  101.         DeselectWeaponWait(indy);
  102.  
  103.         SetExtCamOffset('0.2 0.1 0.1');
  104.  
  105.         # RT: Also forgot to start the cutscene
  106.         StartCutscene(0);
  107.  
  108.         # RT: Now it's okay to capture indy
  109.         CaptureThing(indy);
  110.         PlayKey(indy, in_reach, 5, 0x12, 0); 
  111.         bStartCutscene = 0;
  112.     }
  113.  
  114.     return;
  115.  
  116. callback:
  117.     if (GetParam(1) == 16)
  118.     {
  119.         # Indy is halfway through with his reach animation, so take the can off the jeep, or
  120.         # put it back, as appropriate.
  121.  
  122.         meshRef = GetThingUserData(jeep);
  123.  
  124.         ReleaseThing(indy);
  125.         if (isTakingCan == 1)
  126.         {
  127.             # The gas can is currently attached to the jeep - give it to the player.
  128.  
  129.             RestoreThingMesh(jeep, meshRef);
  130.             SetThingUserData(jeep, -1);
  131.             PlaySoundLocal(gasCanOn, 1.0, 0, 0, 0);
  132.  
  133.             SetInvAvailable(indy, gasCanBin, 1);
  134.             ChangeInv(indy, gasCanBin, 1.0);
  135.             JonesInvItemChanged(gasCanBin);            
  136.  
  137.             SendMessage(GetThingCaptureCog(jeep), user0);
  138.  
  139.             Sleep(1.0);
  140.             PlayVoice(indy, someGas, 1.0, 0);
  141.         }
  142.         else
  143.         {
  144.             # The player is activating us with the gas can - put it back on the jeep.
  145.             jeepMesh = GetMeshByName(jeep, "jeep_body");
  146.             meshRef = SetThingMesh(jeep, jeepMesh, jeepGasCan, 0);
  147.             PlaySoundLocal(gasCanOff, 1.0, 0, 0, 0);
  148.  
  149.             SetThingUserData(jeep, meshRef);
  150.  
  151.             ChangeInv(indy, gasCanBin, -1.0);
  152.             SetInvAvailable(indy, gasCanBin, 0);
  153.  
  154.             SendMessage(GetThingCaptureCog(jeep), user1);
  155.         }
  156.     }
  157.  
  158.     RestoreExtCam();
  159.     ClearActorFlags(indy, 0x200000);
  160.     EndCutscene();
  161.  
  162.     return;
  163. end
  164.